package com.jerry.basic.thread;

public class HelloThreadYieldRun implements Runnable {

	@SuppressWarnings("static-access")
	public void run() {
        for(int i=0;i<5;++i){
            if(i==3){
                System.out.println("线程的礼让");
                Thread.currentThread().yield();
            }
            System.out.println(Thread.currentThread().getName()+"运行"+i);
        }
    }
 
    public static void main(String[] args) {
        Thread h1=new Thread(new HelloThreadYieldRun(),"A");
        Thread h2=new Thread(new HelloThreadYieldRun(),"B");
        h1.start();
        h2.start();
         
    }

}
